import { Menu } from 'src/app/@core/interface/home'
import { NAVALL } from '..'

export const todoReducer = (state: Menu[] = NAVALL, action) => {
  switch (action.type) {
    case 'ADD_TODO':
      if (action.payload) {
        const { name, value, link, img } = action.payload

        return [
          ...state,
          {
            name,
            value,
            link,
            img
          }
        ]
      }
      break

    case 'RESET_TODO':
      return []

    default:
      return state
  }
}
